﻿using System;
using System.Data;
using System.IO;
using System.Xml;
using System.Configuration;
using System.ComponentModel;
using System.Collections.Generic;

namespace GreatB2C.Config.SiteInfo
{
    public class UploadConfig
    {
        #region 文件上传配置
        /// <summary>
        /// 是否允许上传文件
        /// </summary>
        public static string EnableUploadFiles
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "EnableUploadFiles" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "EnableUploadFiles" , value );
            }
        }

        /// <summary>
        /// 允许上传的最大文件大小
        /// </summary>
        public static string UploadFileMaxSize
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "UploadFileMaxSize" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "UploadFileMaxSize" , value );
            }
        }

        /// <summary>
        /// 网站上传目录
        /// </summary>
        public static string UploadDir
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "UploadDir" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "UploadDir" , value );
            }
        }

        /// <summary>
        /// 允许上传的文件类型
        /// </summary>
        public static string UploadFileExts
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "UploadFileExts" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "UploadFileExts" , value );
            }
        }

        /// <summary>
        /// 上传文件的保存目录规则
        /// </summary>
        public static string UploadFilePathRule
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "UploadFilePathRule" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "UploadFilePathRule" , value );
            }
        }

        /// <summary>
        /// 上传文件名保存规则
        /// </summary>
        public static string FileNameRule
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "FileNameRule" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "FileNameRule" , value );
            }
        }

        /// <summary>
        /// 广告上传配置
        /// </summary>
        public static string AdzoneFileType
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "AdzoneFileType" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "AdzoneFileType" , value );
            }
        }
        public static string AdzoneFilePath
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "AdzoneFilePath" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "AdzoneFilePath" , value );
            }
        }

        /// <summary>
        /// 作者上传配置
        /// </summary>
        public static string AuthorFileType
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "AuthorFileType" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "AuthorFileType" , value );
            }
        }
        public static string AuthorFilePath
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "AuthorFilePath" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "AuthorFilePath" , value );
            }
        }

        /// <summary>
        /// 来源上传配置
        /// </summary>
        public static string SourceFileType
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "SourceFileType" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "SourceFileType" , value );
            }
        }
        public static string SourceFilePath
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "SourceFilePath" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "SourceFilePath" , value );
            }
        }

        /// <summary>
        /// 用户上传配置
        /// </summary>
        public static string UserFileType
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "UserFileType" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "UserFileType" , value );
            }
        }
        public static string UserFilePath
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "UserFilePath" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "UserFilePath" , value );
            }
        }

        /// <summary>
        /// 品牌上传配置
        /// </summary>
        public static string TrademarkFileType
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "TrademarkFileType" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "TrademarkFileType" , value );
            }
        }
        public static string TrademarkFilePath
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "TrademarkFilePath" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "TrademarkFilePath" , value );
            }
        }

        /// <summary>
        /// 厂商上传配置
        /// </summary>
        public static string ProducerFileType
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "ProducerFileType" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "ProducerFileType" , value );
            }
        }
        public static string ProducerFilePath
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "ProducerFilePath" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "ProducerFilePath" , value );
            }
        }

        /// <summary>
        /// 商品缩略图和清晰图上传配置
        /// </summary>
        public static string ShopFileType
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "ShopFileType" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "ShopFileType" , value );
            }
        }
        public static string ShopFilePath
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "ShopFilePath" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "ShopFilePath" , value );
            }
        }

        /// <summary>
        /// 商品样式上传配置
        /// </summary>
        public static string ProductstyleFileType
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "ProductstyleFileType" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "ProductstyleFileType" , value );
            }
        }
        public static string ProductstyleFilePath
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "ProductstyleFilePath" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "ProductstyleFilePath" , value );
            }
        }

        /// <summary>
        /// 多图商品上传配置
        /// </summary>
        public static string ProductmultiplephotoFileType
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "ProductmultiplephotoFileType" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "ProductmultiplephotoFileType" , value );
            }
        }
        public static string ProductmultiplephotoFilePath
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "ProductmultiplephotoFilePath" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "ProductmultiplephotoFilePath" , value );
            }
        }

        /// <summary>
        /// 邮件附件上传配置
        /// </summary>
        public static string EmailAttachFileType
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "EmailAttachFileType" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "EmailAttachFileType" , value );
            }
        }
        public static string EmailAttachFilePath
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "EmailAttachFilePath" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "EmailAttachFilePath" , value );
            }
        }

        /// <summary>
        /// 短消息附件上传配置
        /// </summary>
        public static string MessageAttachFileType
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "MessageAttachFileType" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "MessageAttachFileType" , value );
            }
        }
        public static string MessageAttachFilePath
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "MessageAttachFilePath" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "MessageAttachFilePath" , value );
            }
        }

        /// <summary>
        /// 博客上传配置
        /// </summary>
        public static string BlogFileType
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "BlogFileType" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "BlogFileType" , value );
            }
        }
        public static string BlogFilePath
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "BlogFilePath" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "BlogFilePath" , value );
            }
        }

        /// <summary>
        /// 任务上传配置
        /// </summary>
        public static string TaskFileType
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "TaskFileType" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "TaskFileType" , value );
            }
        }
        public static string TaskFilePath
        {
            get
            {
                return BaseConfig.GetConfigValue( BaseConfig.eConfigs.UploadFile , "TaskFilePath" );
            }
            set
            {
                BaseConfig.SetConfigValue( BaseConfig.eConfigs.UploadFile , "TaskFilePath" , value );
            }
        }

        public static bool Config( string EnableUploadFiles , string UploadFileMaxSize , string UploadDir , string UploadFileExts
            , string UploadFilePathRule , string FileNameRule , string AdzoneFileType , string AdzoneFilePath
            , string AuthorFileType , string AuthorFilePath , string SourceFileType , string SourceFilePath
            , string UserFileType , string UserFilePath , string TrademarkFileType , string TrademarkFilePath
            , string ProducerFileType , string ProducerFilePath , string ShopFileType , string ShopFilePath
            , string ProductstyleFileType , string ProductstyleFilePath , string ProductmultiplephotoFileType , string ProductmultiplephotoFilePath
            , string EmailAttachFileType , string EmailAttachFilePath , string MessageAttachFileType , string MessageAttachFilePath
            , string BlogFileType , string BlogFilePath , string TaskFileType , string TaskFilePath )
        {
            Dictionary<string , string> dicts = new Dictionary<string , string>( );

            dicts.Add( "EnableUploadFiles" , EnableUploadFiles );
            dicts.Add( "UploadFileMaxSize" , UploadFileMaxSize );
            dicts.Add( "UploadDir" , UploadDir );
            dicts.Add( "UploadFileExts" , UploadFileExts );
            dicts.Add( "UploadFilePathRule" , UploadFilePathRule );
            dicts.Add( "FileNameRule" , FileNameRule );
            dicts.Add( "AdzoneFileType" , AdzoneFileType );
            dicts.Add( "AdzoneFilePath" , AdzoneFilePath );
            dicts.Add( "AuthorFileType" , AuthorFileType );
            dicts.Add( "AuthorFilePath" , AuthorFilePath );
            dicts.Add( "SourceFileType" , SourceFileType );
            dicts.Add( "SourceFilePath" , SourceFilePath );
            dicts.Add( "UserFileType" , UserFileType );
            dicts.Add( "UserFilePath" , UserFilePath );
            dicts.Add( "TrademarkFileType" , TrademarkFileType );
            dicts.Add( "TrademarkFilePath" , TrademarkFilePath );
            dicts.Add( "ProducerFileType" , ProducerFileType );
            dicts.Add( "ProducerFilePath" , ProducerFilePath );
            dicts.Add( "ShopFileType" , ShopFileType );
            dicts.Add( "ShopFilePath" , ShopFilePath );
            dicts.Add( "ProductstyleFileType" , ProductstyleFileType );
            dicts.Add( "ProductstyleFilePath" , ProductstyleFilePath );
            dicts.Add( "ProductmultiplephotoFileType" , ProductmultiplephotoFileType );
            dicts.Add( "ProductmultiplephotoFilePath" , ProductmultiplephotoFilePath );
            dicts.Add( "EmailAttachFileType" , EmailAttachFileType );
            dicts.Add( "EmailAttachFilePath" , EmailAttachFilePath );
            dicts.Add( "MessageAttachFileType" , MessageAttachFileType );
            dicts.Add( "MessageAttachFilePath" , MessageAttachFilePath );
            dicts.Add( "BlogFileType" , BlogFileType );
            dicts.Add( "BlogFilePath" , BlogFilePath );
            dicts.Add( "TaskFileType" , TaskFileType );
            dicts.Add( "TaskFilePath" , TaskFilePath );

            return BaseConfig.SetConfigForBatch( BaseConfig.eConfigs.UploadFile , dicts );
        }
        #endregion
    }
}
